<template>
	<div id="app">
		<div id="login">
			<div class="con">
				<ul class="num">
					<li class="num_list">
						<img src="https://yo.docshare.org.cn/static/images/my.png">
						<div class="am-form-group">
							<input class="uni-input" name="input" v-model="usr" placeholder="请输入用户名" />
						</div>
						<div class="clear"></div>
					</li>
					<li class="num_list">
						<img src="https://yo.docshare.org.cn/static/images/password.png">
						<div class="am-form-group">
							<input type="password" class="uni-input-password" name="input" v-model="pwd"
								placeholder="请输入密码" />
						</div>
						<div class="clear"></div>
					</li>
				</ul>
				<div style="text-align: right;margin-top: 10px;">
					<view class="return" @click="uni.navigateTo({
					url:'./verity'
					
				})"><u style="color: #000000;">？忘记密码</u></view>
				</div>
				<div class="find">
					<div class="clear"></div>
				</div>
				<view @click="submit()" class="lanch" style="background-color: #61ac85;border: 1px solid #579572;">登录
				</view>
				<view @click="uni.navigateTo({
					url:'./regist'
					
				})">
					<div class="enroll" style="background-color: #8fb2c9;border: 1px solid #3b818c;">注册</div>
				</view>
			</div>
		</div>
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				config,
				uni,
				usr: '',
				pwd: ''
			}
		},
		methods: {
			submit: function() {
				var that = this;
				uni.request({
					url: `${config.baseUrl}/login`,
					method: 'POST',
					data: {
						'usr': this.usr,
						'pwd': this.pwd
					},
					success(r) {
						if (r.data.succ) {
							uni.setStorage({
								key: "token",
								data: r.data.data,
							});
							uni.navigateTo({
								url: '../main/index'
							})
						} else {

						}
					},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
				})
			}
		}
	}
</script>

<style>
</style>
